<?php
	$process_type = "add";	// Please choose only ONE !! Edit / Preview / Delete . 'Edit' and 'Add' are considered as the same value.
	$process_module_name = "images";	// Module Name
	$process_module_id = "5";	// Module ID
	$process_module_sub_id = "0";	// Module Sub ID
	$process_module_category = "management"; // Module Category
	$rowDivWidth = 60;	// Width for first column label form (pixel)
	$rowDivWidth2 = 140;	// Width for first column label form (pixel)
	$form_name = "form_images";	// Form Name
	$form_action = "proc_images.php";	// Form Action
?>
<div class="content">
	<form action="process/<?php echo $form_action; ?>" method="post" enctype="multipart/form-data" name="<?php echo $form_name; ?>" id="files" style="margin:0; padding:0;">
	<?php include("action/act_includes_global/1_act_inc_global_formstartconfig.php"); // Do not Edit !!! ?>
	<?php include("action/act_includes_global/3_act_inc_global_formrowdatahidden.php"); // Do not Edit !!! Every form must include this file !  ?>
	
	<div class="content_header_left">
		<!-- Start Content Header Left -->
		<?php include("ws_includes/1_ws_inc_priviligestring.php"); ?>
		<?php include("ws_includes/2_ws_inc_headerlabel.php"); ?>
		<!-- End Content Header Left -->
	</div>
	<div class="content_header_right">
		<!-- Start Content Header Right -->
		
		<!-- End Content Header Right -->
	</div>
	<div style="clear:both;"></div>
	<div class="content_body">
		<!-- Start Content Body -->
		<?php if($privilegeView == 1) { ?>
			<div style="padding:10px; border:solid 1px black;">
				<div style="float:left; padding:10px;">
					<div class="divFormRowData">
						<span class="header_label_string">UPLOAD IMAGE</span>
						<br />
						<br />
					</div>
					<div class="divFormRowData">
						<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">File</div>
						<div style="float:left;">&nbsp;:&nbsp;</div>
						<div style="float:left;">
							<input type="file" name="file" id="file" required style="width:400px;" />
						</div>
						<div style="clear:both;"></div>
					</div>
					<div class="divFormRowData">
						<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Label</div>
						<div style="float:left;">&nbsp;:&nbsp;</div>
						<div style="float:left;">
							<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="text" required name="txt_image_label" style="width:300px; height:18px;" />
						</div>
						<div style="clear:both;"></div>
					</div>
					<div class="divFormRowData">
						<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Position</div>
						<div style="float:left;">&nbsp;:&nbsp;</div>
						<div style="float:left;">
							<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="number" required min="1" max="100" name="txt_image_position" value="1" style="width:50px; height:18px; font-size:10px;" />
						</div>
						<div style="clear:both;"></div>
					</div>
					<div class="divFormRowData">
						<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Activate</div>
						<div style="float:left;">&nbsp;:&nbsp;</div>
						<div style="float:left;">
							<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="radio" name="rdo_image_activate" value="1" checked="checked" /> Yes
							<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="radio" name="rdo_image_activate" value="0" /> No
						</div>
						<div style="clear:both;"></div>
					</div>
					<div class="divFormRowData">
						<div style="float:left;">
							<input type="submit" name="submit" value="Upload" />
						</div>
						<div style="clear:both;"></div>
					</div>
				</div>
				<div style="float:right; padding:10px; border:solid 1px black;">
					<div class="divFormRowData">
						<span class="header_label_string">IMAGE RULES</span>
						<br />
						<br />
					</div>
					<div class="divFormRowData">
						<div style="float:left; text-align:right; width:<?php echo $rowDivWidth2; ?>px;">Max File Size allowed</div>
						<div style="float:left;">&nbsp;:&nbsp;</div>
						<div style="float:left;"><?php echo format_size(image_size_allowed()); ?></div>
						<div style="clear:both;"></div>
					</div>
					<div class="divFormRowData">
						<div style="float:left; text-align:right; width:<?php echo $rowDivWidth2; ?>px;">File Extension allowed</div>
						<div style="float:left;">&nbsp;:&nbsp;</div>
						<div style="float:left;"><?php echo implode("<br />",image_extension_allowed()); ?></div>
						<div style="clear:both;"></div>
					</div>
					<div class="divFormRowData">
						<div style="float:left; text-align:right; width:<?php echo $rowDivWidth2; ?>px;">File Type allowed</div>
						<div style="float:left;">&nbsp;:&nbsp;</div>
						<div style="float:left;"><?php echo implode("<br />",image_type_allowed()); ?></div>
						<div style="clear:both;"></div>
					</div>
				</div>
				
				<div style="clear:both;"></div>
			</div>
			<div style="padding:10px; border:solid 1px black; margin-top:10px; overflow: auto;">
				<?php
					$sql = "select a.* , b.imagewidth, b.imageheight
							from ms_file a 
								left join ms_image b
									on a.fileid = b.fileid
							where a.stsrc = 'A' and a.filerole = 'image' order by a.dateup desc, a.datein desc";
					$exe = mysql_query($sql) or die(mysql_error());
					$num = mysql_num_rows($exe);
					
					if($num > 0)
					{
				?>
				<table id="table" border="1" cellpadding="2" cellspacing="0">
				<thead>
					<tr>
						<th filter="false">#</th>
						<th>Position</th>
						<th>Label</th>
						<th>Size</th>
						<th>Width</th>
						<th>Height</th>
						<th filter-type='ddl'>Type</th>
						<th filter-type='ddl'>Status</th>
						<th filter="false">Preview</th>
						<th filter="false">Action</th>
					</tr>
				</thead>
				<?php
						$number_count = 1;
						while($row = mysql_fetch_array($exe))
						{
				?>
					<tr>
						<td><?php echo $number_count; ?></td>
						<td><?php echo $row['fileposition']; ?></td>
						<td><?php echo $row['filelabel']; ?></td>
						<td><?php echo format_size($row['filesize']); ?></td>
						<td><?php echo $row['imagewidth']; ?></td>
						<td><?php echo $row['imageheight']; ?></td>
						<td><?php echo $row['filetype']; ?></td>
						<td>
							<?php if($row['filestatus'] == 1){echo "<span style='color:green;'>ON</span>";}else{echo "<span style='color:red;'>OFF</span>";} ?>
						</td>
						<td><img src="<?php echo getURLdomain()."/upload/".$row['filename']; ?>" style="max-width:100px; max-height:24px;" /></td>
						<td>
							<div style="width:100%;">
								<div class="divRowActionCell">
									<div class="divRowAction">
										<a title="Preview" href="action/act_images_preview.php#<?php echo $row['fileid']; ?>" class="nyroModal">
											<img src="<?php echo getURLdomain(); ?>/source/global/img/preview-icon.png" width="24">
										</a>
									</div>
									<?php if($privilegeEdit == 1) { ?>
									<div class="divRowAction">
										<a title="Edit" href="action/act_images_addedit.php#<?php echo $row['fileid']; ?>" class="nyroModal">
											<img src="<?php echo getURLdomain(); ?>/source/global/img/edit-icon.png" width="24">
										</a>
									</div>
									<?php } ?>
									<?php if($privilegeDelete == 1) { ?>
									<div class="divRowAction">
										<a title="Delete" href="action/act_images_delete.php#<?php echo $row['fileid']; ?>" class="nyroModal">
											<img src="<?php echo getURLdomain(); ?>/source/global/img/delete-icon.png" width="24">
										</a>
									</div>
									<?php } ?>
									<div class="clear"></div>
								</div>
							</div>
						</td>
					</tr>
				<?php
							$number_count++;
						}
					}
					else
					{
				?>
						No data !
				<?php
					}
				?>
				</table>
			</div>
		<?php } ?>
		<!-- End Content Body -->
	</div>
	<div style="clear:both;"></div>
	</form>
</div>